package com.fc.incross_server.config;

import com.fc.incross_server.filter.ServerRequestFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: GY.
 * @Description: 用于外网http请求-->反向代理服务器-->当前服务
 * @Date:Created in 2020/2/24 0024.
 * @Modified By:
 */
@Configuration
public class WebConfig {
    @Autowired
    private ServerRequestFilter serverRequestFilter;

    @Bean
    public FilterRegistrationBean someFilterRegistration1() {
        //新建过滤器注册类
        FilterRegistrationBean registration = new FilterRegistrationBean();
        // 添加我们写好的过滤器
        registration.setFilter(serverRequestFilter);
        // 设置过滤器的URL模式
        registration.addUrlPatterns("/*");
        return registration;
    }

}
